home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 40 / 040.d81 / pixel puzzler (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  239 lines

  1. 10 ifx>.then100
  2. 20 poke53280,1:poke53281,1
  3. 30 printchr$(142)"[147] gathering the pieces to the puzzle..."
  4. 100 ifx=0thenx=1:load"text.3.o",8,1
  5. 120 ifx=1thenx=2:load"ram.lnk",8,1
  6. 130 ifx=2thenx=3:load"unpacker",8,1
  7. 140 ifx=3thenx=4:load"hand.spr",8,1
  8. 150 :
  9. 160 ni=42 : rem number of items 6*7
  10. 170 na=6  : rem number across
  11. 180 nd=6  : rem number down-1
  12. 182 v=53248:rem vic
  13. 190 :
  14. 200 poke249,224:poke250,204:dima%(ni)
  15. 210 sys51459:poke53280,2: rem show screen
  16. 220 poke828,0:poke829,39:poke830,0:poke831,24:sys49152:sys49158,22
  17. 230 :
  18. 235 pokev+21,0
  19. 240 sys49161,"[208][201][195][203] [217][207][213][210] [205][207][196][197]",13,5,0
  20. 250 sys49161,"--------------",13,6,0
  21. 260 sys49161,"1 ==> [215][201][206][206][197][210]",12,8,0
  22. 270 sys49161,"2 ==> [201][206][212][197][210][205][197][196][201][193][212][197]",12,10,0
  23. 275 sys49161,"3 ==> [204][207][211][197][210]",12,12,0
  24. 280 sys49161,"4 ==> [210][197][212][213][210][206] [212][207] [204][207][193][196][211][212][193][210]",12,14,0
  25. 290 poke198,0:wait198,1:getmo$:mo=val(mo$):ifmo>=1andmo<=4then320
  26. 300 sys49167,1000,33,15,15:fordl=1to1000:next
  27. 310 sys49167,1000,32,0,0:goto290
  28. 320 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
  29. 330 ifmo=1thenforx=1toni:a%(x)=x:next:cf=1:goto510
  30. 340 ifmo=4then1020
  31. 350 gosub 1680
  32. 355 gosub 4000 : rem show picture
  33. 360 :
  34. 370 sys49161,"[208][210][197][211][211] '[200]' [198][207][210] [200][197][204][208]",11,23,1
  35. 372 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,1,1
  36. 380 :
  37. 390 :
  38. 400 :
  39. 410 cf=0
  40. 420 poke1016+52224,24:pokev+39,5:pokev,60:pokev+1,68
  41. 430 pokev+29,0:pokev+23,0:pokev+16,0
  42. 440 pokev+21,1
  43. 450 :
  44. 460 ifgip=1then510
  45. 470 forx=1toni:a%(x)=x:next
  46. 480 forx=1toni:r1=rnd(1)*ni+1:r2=rnd(1)*ni+1:t=a%(r1):a%(r1)=a%(r2)
  47. 490 a%(r2)=t:next
  48. 495 ro=0:co=1
  49. 500 :
  50. 510 gosub 3300 : rem plot them puppies
  51. 600 :
  52. 610 fl=0
  53. 620 forx=0toni-1
  54. 630 ifa%(x+1)<>x+1thenfl=1
  55. 640 ifa%(x+1)=nithenbl=x
  56. 650 next
  57. 660 :
  58. 670 ifcf=1then1530
  59. 680 iffl=0thensys49161,"               [217][207][213] [215][207][206]!!             ",1,0,0:goto1450
  60. 690 j=56320
  61. 700 gosub 1080
  62. 710 a=co+ro*na
  63. 720 br=int(bl/na):bc=bl-na*br:bc=bc+1
  64. 730 ifmo=2anda%(a)<>nithen1600 : rem plop it
  65. 740 if(br<>roandbc<>co)ora%(a)=nithen970
  66. 750 ifbr<>rothen870
  67. 760 if bc>cothenb=bc:e=co+1:i=-1
  68. 770 if bc<cothenb=bc:e=co-1:i=1
  69. 780 forx=btoestepi
  70. 790 t=ro*na+x:f=ro*na+x+i
  71. 800 a%(t)=a%(f)
  72. 810 poke254,2+ro*3:poke253,x*5:poke255,a%(t)-1:sys51462
  73. 820 poke254,2+ro*3:poke253,(x+i)*5:poke255,ni-1:sys51462
  74. 830 next
  75. 840 ag=3.34:a%(ro*na+x)=ni
  76. 850 goto 610
  77. 860 :
  78. 870 ifbc<>cothen960
  79. 880 ifbr>rothenb=br:e=ro+1:i=-1
  80. 890 ifbr<rothenb=br:e=ro-1:i=1
  81. 900 forx=btoestepi
  82. 910 t=x*na+co:f=(x+i)*na+co:a%(t)=a%(f)
  83. 920 poke253,co*5:poke254,2+x*3:poke255,a%(t)-1:sys51462
  84. 930 poke253,co*5:poke254,2+(x+i)*3:poke255,ni-1:sys51462
  85. 940 ag=3.34:next
  86. 950 a%(x*na+co)=ni:goto610
  87. 960 :
  88. 970 sys49161,"            [201][204][204][197][199][193][204] [205][207][214][197]            ",1,0,0:sys49167,1000,33,15,15
  89. 980 fordl=1to500:next:sys49167,0,32,0,0
  90. 990 sys49161,"            ",13,0,0
  91. 1000 goto 700
  92. 1010 :
  93. 1020 pokev+21,0:pokev+16,0:print"[147]":sys51459
  94. 1030 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  95. 1040 ifer<>63thenend
  96. 1050 load"hello connect",8
  97. 1060 end
  98. 1070 :
  99. 1080 rem read keyboard and joystick
  100. 1090 ifpeek(198)=0andpeek(j)=127then1090
  101. 1100 geta$:js=peek(j):ifjs=111ora$=chr$(13)thenreturn
  102. 1110 cf=0:ifa$="w"thenforx=1toni:a%(x)=x:next:cf=1:goto510
  103. 1115 ifa$="h"thengosub3000:sys49161,"[208][210][197][211][211] '[200]' [198][207][210] [200][197][204][208]",11,23,1:goto510
  104. 1120 ifa$="m"thengosub1320:goto1090
  105. 1130 ifa$="s"thengosub1980:goto1090
  106. 1135 ifa$="v"thenpokev+21,.:gosub4000:pokev+21,1:goto1090
  107. 1140 ifa$=""orjs=119thenco=co+1
  108. 1150 ifa$="[157]"orjs=123thenco=co-1
  109. 1160 ifa$=""orjs=125thenro=ro+1
  110. 1170 ifa$="[145]"orjs=126thenro=ro-1
  111. 1180 ifjs=118thenco=co+1:ro=ro-1
  112. 1190 ifjs=117thenco=co+1:ro=ro+1
  113. 1200 ifjs=121thenco=co-1:ro=ro+1
  114. 1210 ifjs=122thenco=co-1:ro=ro-1
  115. 1220 :
  116. 1230 ifco<1thenco=1
  117. 1240 ifro<0thenro=0
  118. 1250 ifro>ndthenro=nd
  119. 1260 ifco>nathenco=na
  120. 1270 :
  121. 1280 pokev,21+co*39:pokev+1,68+ro*24:pokev+16,0
  122. 1290 goto1090
  123. 1300 :
  124. 1310 :
  125. 1320 rem  quit
  126. 1330 sys49161,"   [196][207] [217][207][213] [215][193][206][212] [212][207] [209][213][201][212] [212][200][201][211] [208][213][218][218][204][197]?   ",1,0,0
  127. 1340 forx=1to100:ifpeek(198)=0thennextx
  128. 1350 ifpeek(198)<>0then1410
  129. 1360 sys49161,"                                   ",4,0,0
  130. 1370 fory=1to100:ifpeek(198)=0thennexty
  131. 1380 ifpeek(198)<>0then1410
  132. 1390 goto1330
  133. 1400 :
  134. 1410 geta$
  135. 1420 ifa$<>"y"thensys49161,"                                ",4,0,0:return
  136. 1430 :
  137. 1440 goto220
  138. 1445 :
  139. 1450 rem win
  140. 1460 poke253,na*5:poke254,2+nd*3:poke255,ni:sys51462:ag=3.34
  141. 1470 forx=1000to20000step500:sys49167,x,33,15,15:next
  142. 1480 forx=1000to20000step500:sys49167,x,33,15,15:next
  143. 1490 forx=1000to20000step500:sys49167,x,33,15,15:next
  144. 1500 sys49167,0,32,0,0
  145. 1510 fordl=1to100:nextdl
  146. 1520 :
  147. 1530 poke253,na*5:poke254,2+nd*3:poke255,ni:sys51462:ag=3.34
  148. 1540 sys49161,"      [196][207] [217][207][213] [215][193][206][212] [212][207] [208][204][193][217] [193][199][193][201][206]?   ",1,0,0
  149. 1550 poke198,0:wait198,1
  150. 1560 geta$:ifa$="y"then220
  151. 1570 ifa$<>"n"then1550
  152. 1580 goto1020
  153. 1590 :
  154. 1600 rem plop it
  155. 1610 ifa%(a)=nithen870
  156. 1620 t=a%(a):a%(a)=a%(bl+1):a%(bl+1)=t
  157. 1630 poke254,2+ro*3:poke253,co*5
  158. 1640 poke255,ni-1:sys51462:ag=3.34
  159. 1650 poke254,2+br*3:poke253,bc*5
  160. 1660 poke255,t-1:sys51462:ag=3.34
  161. 1670 goto610
  162. 1680 rem  game in progress
  163. 1690 gip=0:pokev+21,0
  164. 1700 sys49161,"[215][207][213][204][196] [217][207][213] [204][201][203][197] [212][207] [204][207][193][196] [193]",10,10,0
  165. 1710 sys49161,"[199][193][205][197] [201][206] [208][210][207][199][210][197][211][211]?",10,12,0
  166. 1720 poke198,0:wait198,1:geta$:ifa$<>"y"then1790
  167. 1730 :
  168. 1740 f$="pp.gip"
  169. 1750 gip=1
  170. 1760 open2,8,2,f$
  171. 1770 forx=1toni:input#2,a%(x):next
  172. 1780 close2
  173. 1790 pokev+21,1:return
  174. 1970 :
  175. 1980 rem save gip
  176. 1990 rem
  177. 2000 sys49161,"      [211][193][214][201][206][199] [199][193][205][197] [201][206] [208][210][207][199][210][197][211][211]...      ",1,1,0
  178. 2010 open15,8,15,"i0":print#15,"s0:pp.gip":close15
  179. 2020 :
  180. 2030 f$="0:pp.gip,s,w"
  181. 2040 open2,8,2,f$
  182. 2050 forx=1toni
  183. 2060 print#2,a%(x)
  184. 2070 next
  185. 2080 close2
  186. 2090 sys49161,"                                     ",1,1,0
  187. 2092 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,1,1
  188. 2100 return
  189. 3000 rem help
  190. 3010 pokev+21,0
  191. 3015 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
  192. 3020 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,3,0
  193. 3030 sys49161,"[212][207] [205][207][214][197] [212][200][197] [200][193][206][196], [213][211][197] [212][200][197] [195][213][210][211][207][210]",4,5,0
  194. 3040 sys49161,"[203][197][217][211] [207][210] [212][200][197] [202][207][217][211][212][201][195][203] ([201][206] [208][207][210][212] 2).",2,6,0
  195. 3050 sys49161,"[215][200][197][206] [212][200][197] [200][193][206][196] [201][211] [207][206] [212][200][197] [208][201][197][195][197]",4,8,0
  196. 3060 sys49161,"[217][207][213] [215][201][211][200] [212][207] [205][207][214][197], [208][210][197][211][211] [210][197][212][213][210][206] [207][210]",2,9,0
  197. 3062 sys49161,"[212][200][197] [198][201][210][197][194][213][212][212][207][206].",2,10,0
  198. 3080 sys49161,"[212][207] [211][193][214][197] [193] [199][193][205][197], [208][210][197][211][211] '[211]'",2,12,0
  199. 3090 sys49161,"[212][207] [199][197][212] [212][207] [212][200][197] [205][197][206][213], [208][210][197][211][211] '[205]'",2,14,0
  200. 3092 sys49161,"[212][207] [214][201][197][215] [212][200][197] [197][206][212][201][210][197] [208][201][195][212][213][210][197], [208][210][197][211][211] '[214]'",2,16,0
  201. 3094 sys49161,"[208][210][197][211][211] [193] [203][197][217] [212][207] [195][207][206][212][201][206][213][197].",7,21,0
  202. 3095 :
  203. 3100 :
  204. 3102 pokev+21,0
  205. 3110 poke198,0:wait198,1:poke198,0:pokev+21,1
  206. 3120 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
  207. 3125 poke828,1:poke829,38:poke830,1:poke831,23
  208. 3130 return
  209. 3200 :
  210. 3300 rem  plot the shapes
  211. 3310 xp=1:yp=-1:fl=0
  212. 3320 forx=0toni-1
  213. 3330 ifa%(x+1)<>x+1thenfl=1
  214. 3340 ifint(x/na)=x/nathenyp=yp+3:xp=1
  215. 3350 poke251,0:poke252,64
  216. 3360 poke2